/*
* @Author: wanghongfucoder
* @Date:   2017-03-08 09:18:30
* @Last Modified by:   wanghongfucoder
* @Last Modified time: 2017-03-08 09:28:11
*/

public  class Demo {

	private static AbstractLogger getChainOfLoggers(){
		AbstractLogger errorLogger=new ErrorLogger(AbstractLogger.ERROR);
		AbstractLogger fileLogger=new FileLogger(AbstractLogger.DEBUG);
		AbstractLogger consoleLogger=new ConsoleLogger(AbstractLogger.INFO);
		errorLogger.setNextLogger(fileLogger);
		fileLogger.setNextLogger(consoleLogger);
		return errorLogger;
	}

	public static void main(String[] args) {
		AbstractLogger loggerChain=getChainOfLoggers();
		loggerChain.logMessage(AbstractLogger.INFO,"this is anpush information");
		loggerChain.logMessage(AbstractLogger.DEBUG,"this is an debug level information");
		loggerChain.logMessage(AbstractLogger.ERROR,"this is an error information");

	}
}